Skip to content

Arrow key size #5565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 14, 2023
Merged

Arrow key size #5565

merged 5 commits into from
Dec 14, 2023

Conversation

teunbrand
Copy link
Collaborator

This PR implements #5465 (comment) for arrow-based keys.

Briefly, it allows arrows to allocate legend key space for themselves.

I think a visual demonstrates the effect best.
We go from this at current main branch:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

ggplot(mapping = aes(x = 0, xend = 1)) +
  geom_segment(
    aes(y = 0, yend = 0, colour = "arrow 1"),
    arrow = arrow(length = unit(1, "cm"), angle = 10)
  ) +
  geom_segment(
    aes(y = 1, yend = 1, colour = "arrow 2"),
    arrow = arrow(length = unit(1, "cm"), angle = 70, ends = "both")
  ) +
  geom_segment(
    aes(y = 2, yend = 2, colour = "arrow 3"),
    arrow = arrow(length = unit(1, "cm"), angle = 45, ends = "first")
  )

Created on 2023-12-04 with reprex v2.0.2

To the following with this PR:

@thomasp85 thomasp85 added this to the ggplot2 3.5.0 milestone Dec 14, 2023
@teunbrand teunbrand merged commit e5abb05 into tidyverse:main Dec 14, 2023
@teunbrand teunbrand deleted the arrow_key_size branch December 14, 2023 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants